<?php
    header("Content-Type: text/html; charset=utf-8"); 

    class ApiAction extends Action{

        public function read(){
            $stu_id = I('get.stu_id');
            $password = I('get.password');
            $StudentModel = D('Student');
            $map = array();
            $map['stu_id'] = $stu_id;
            $map['password'] = $password;
            $data = $StudentModel->where($map)->find();
            $rs = array();
            $rs['student'] = $data;
			$this->ajaxReturn($rs);
    }

        public function check(){
			$stu_id = $_GET['stu_id'];
			$password = $_GET['password'];

			$user = D('Student');
			$data = $user->where("stu_id=$stu_id and password=$password")->count();
            if ($data === null) {
                $data = 0;
            }
            
            $this->assign('data', $data);
			$this->display();
		}
	}
	


